package com.itheima.day16_网络编程.Test02;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        Socket s = new Socket("127.0.1.0",10000);
        FileInputStream fis = new FileInputStream("homework\\mn.jpg");
        OutputStream os = s.getOutputStream();
        int i;
        byte[] b = new byte[1024];
        while((i = fis.read(b))!=-1){
            os.write(b,0,i);
        }
        s.shutdownOutput();
        InputStream is = s.getInputStream();
        int x = is.read(b);
        System.out.println(new String(b,0,x));

        fis.close();
        s.close();
    }
}
